import {throttle} from '../utils/index'

/**
 * 节流装饰器
 * @param wait {number} 间隔时间
 * @returns
 */
export default function throttlingDecorator(wait = 200): MethodDecorator {
  return function (target: object, name: string | symbol, descriptor: TypedPropertyDescriptor<any>) {
    descriptor.value = throttle(descriptor.value, wait)
  }
}
